home *** CD-ROM | disk | FTP | other *** search
- class MiniGames.BTW.BTWSpongeBob extends State
- {
- var oParent;
- var oCurrentAim;
- var sState;
- var mcRef;
- static var sSTATE_IDLE = "Idle";
- static var sSTATE_THROW_BALL = "ThrowBall";
- static var nBALL_THROWED_FRAME = 7;
- function BTWSpongeBob(_mcRef, _oParent)
- {
- super(_mcRef);
- this.setState(MiniGames.BTW.BTWSpongeBob.sSTATE_IDLE);
- this.oParent = _oParent;
- this.oCurrentAim = null;
- }
- function throwABall(_oCurrentAim)
- {
- if(this.sState == MiniGames.BTW.BTWSpongeBob.sSTATE_IDLE)
- {
- this.oCurrentAim = _oCurrentAim;
- this.setState(MiniGames.BTW.BTWSpongeBob.sSTATE_THROW_BALL);
- Controller.getRef().getSounds().playRandomSound(CTRLGame.nNB_THROW_SOUNDS,"IceBall_Throwed",Controller.nSFX_VOLUME);
- }
- }
- function Idle()
- {
- }
- function ThrowBall()
- {
- if(this.stateFinished())
- {
- this.setState(MiniGames.BTW.BTWSpongeBob.sSTATE_IDLE);
- }
- else if(this.mcRef.mcState._currentframe == MiniGames.BTW.BTWSpongeBob.nBALL_THROWED_FRAME)
- {
- var _loc2_ = new Object();
- _loc2_.x = 0;
- _loc2_.y = 0;
- _loc2_.x = this.mcRef.mcState.mcBall._x;
- _loc2_.y = this.mcRef.mcState.mcBall._y;
- this.mcRef.mcState.localToGlobal(_loc2_);
- this.mcRef._parent.globalToLocal(_loc2_);
- this.oParent.createBall(this.oCurrentAim,_loc2_.x,_loc2_.y);
- }
- }
- }
-